//
//  YXYBeseTableViewCell.m
//  Topit
//
//  Created by dllo on 15/12/2.
//  Copyright © 2015年 YXY. All rights reserved.
//

#import "YXYBeseTableViewCell.h"

@implementation YXYBeseTableViewCell

-(void)dealloc {
    [_title release];
    [_name release];
    [_desc release];
    [_ts release];
    [_sbjName release];
    [_itemName release];
    [_array release];
    [_from release];
    [_fnum release];
    [_cnum release];
    [_homeModel release];
    [_dataSource release];
    [_briImage release];
    [_focus release];
    [_review release];
    [_Orgview release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
    
        _title = [[UILabel alloc] initWithFrame:CGRectZero];
        _title.font = [UIFont systemFontOfSize:15];
        [self addSubview:_title];
        [_title release];
        
        _ts = [[UILabel alloc] initWithFrame:CGRectZero];
        _ts.font = [UIFont systemFontOfSize:10];
        _ts.textColor = [UIColor grayColor];
        [self addSubview:_ts];
        [_ts release];
        
        _Orgview = [[UIView alloc] initWithFrame:CGRectZero];
        _Orgview.backgroundColor = [UIColor redColor];
        
        _name = [[UILabel alloc] initWithFrame:CGRectZero];
        _name.font = [UIFont systemFontOfSize:10];
        _name.backgroundColor = [UIColor redColor];
        _name.textColor = [UIColor whiteColor];
        _name.textAlignment = 1;
        [_Orgview addSubview:_name];
        [_name release];
        [self addSubview:_Orgview];
        
        _sbjName = [[UILabel alloc] initWithFrame:CGRectZero];
        _sbjName.font = [UIFont systemFontOfSize:8];
//        _sbjName.textColor = [UIColor whiteColor];
        [self addSubview:_sbjName];
        [_sbjName release];
        
        _desc = [[UILabel alloc] initWithFrame:CGRectZero];
        _desc.font = [UIFont systemFontOfSize:10];
        _desc.numberOfLines = 2;
        _desc.textColor = [UIColor grayColor];
        [self addSubview:_desc];
        [_desc release];
        
        _from = [[UILabel alloc] initWithFrame:CGRectZero];
        _from.font = [UIFont systemFontOfSize:7];
        _from.textColor = [UIColor grayColor];
        [self addSubview:_from];
        
        _fnum = [[UILabel alloc] initWithFrame:CGRectZero];
        _fnum.font = [UIFont systemFontOfSize:8];
        _fnum.textColor = [UIColor grayColor];
        [self addSubview:_fnum];
        
        _cnum = [[UILabel alloc] initWithFrame:CGRectZero];
        _cnum.font = [UIFont systemFontOfSize:8];
        _cnum.textColor = [UIColor grayColor];
        [self addSubview:_cnum];
        
        _itemName = [[UILabel alloc] initWithFrame:CGRectZero];
        _itemName.font = [UIFont systemFontOfSize:12];
        _itemName.textColor = [UIColor whiteColor];
        [self addSubview:_itemName];
        
        _focus = [[UIImageView alloc] initWithFrame:CGRectZero];
        _focus.image = [UIImage imageNamed:@"focus"];
        [self addSubview:_focus];
        
        _review = [[UIImageView alloc] initWithFrame:CGRectZero];
        _review.image = [UIImage imageNamed:@"review"];
        [self addSubview:_review];
    }
    return self;
}

-(void)setHomeModel:(HomeModel *)homeModel {
    if (_homeModel != homeModel) {
        [_homeModel release];
        _homeModel = [homeModel retain];
    }

    
    _desc.text = homeModel.desc;
    _name.text = homeModel.name;
    _sbjName.text = homeModel.sbj[@"name"];
    _ts.text = homeModel.ts;
    _title.text = homeModel.title;
    _from.text = @"from";
    
}

-(void)layoutSubviews {
    [super layoutSubviews];
//    _images.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 100);
    _name.frame = CGRectMake(10, 0, 43, 15);
    _from.frame = CGRectMake(_name.frame.origin.x + 48, _name.frame.origin.y, 50, 15);
    _sbjName.frame = CGRectMake(_name.frame.origin.x + 70, _name.frame.origin.y, 50, 15);
    _title.frame = CGRectMake(10, self.frame.size.height - 90, self.frame.size.width, 20);
    _desc.frame = CGRectMake(12, self.frame.size.height - 70, self.frame.size.width - 10, 40);
    _ts.frame = CGRectMake(self.frame.size.width - 90, self.frame.size.height - 30, 80, 20);
    
    _fnum.frame = CGRectMake(_title.frame.origin.x + 20, self.frame.size.height - 30, 100, 20);
    _cnum.frame = CGRectMake(_fnum.frame.origin.x + 60, _fnum.frame.origin.y, 100, 20);
    _itemName.frame = CGRectMake(10, self.frame.size.height - 120, self.frame.size.width, 10);
    _focus.frame = CGRectMake(_fnum.frame.origin.x - 12, _fnum.frame.origin.y + 5, 10, 10);
    _review.frame = CGRectMake(_cnum.frame.origin.x - 12, _cnum.frame.origin.y + 5, 10, 10);
    

}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
